package com.itheima.filter;

import jakarta.servlet.*;
import lombok.extern.slf4j.Slf4j;

import java.io.IOException;

/**
 * @author hu
 * @date 2025/3/10
 */
@Slf4j
//@WebFilter(urlPatterns = "/*")
public class XemoFilter implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        log.info("过滤器初始化=====web服务器启动的时候执行，执行一次");
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        log.info("拦截到了请求======放行前");
        chain.doFilter(request,response);

        log.info("拦截到了请求======放行后");
    }


    @Override
    public void destroy() {
        log.info("过滤器销货=====web服务器销毁的时候执行，执行一次");
    }
}
